const app = getApp();
var config = app.globalData.config;
const http = require('../../utils/http.js');

Page({
	data: {
		status: '',
		chooseid: 1,
		dataList:[],
		atype:0
	},
	choose(e) {
		var chooseid = e.currentTarget.dataset.id;
		var atype = this.data.atype;
		if(chooseid==1){
			atype = 0;
		}
		if(chooseid==2){
			atype = 1;
		}
		if(chooseid==3){
			atype = -1;
		}
		this.setData({
			chooseid: e.currentTarget.dataset.id,
			atype:atype
		});
		this.getTeachAttendList();
	},
	onLoad(options) {
		this.getTeachAttendList();
	},
	getTeachAttendList() {
		var that = this;
		http.httpPost(config.getTeachAttendList, {
			atype:that.data.atype
		}, function(e) {
			if (e.code == 1) {
				if (e.data != []) {
					that.setData({
						dataList: e.data
					});
				} else { //暂无数据
					wx.showToast({
						title: e.msg,
						icon: 'none',
						duration: 3000,
						mask: true
					});
				}

			}
		});
	},
	onReady() {
		if (!app.login()) {
			return;
		}
	},
	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow() {

	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide() {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload() {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh() {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom() {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage() {

	}
})
